{template 'common/header'}
<ul class="we7-page-tab">
	{loop $active_sub_permission $active_menu}
	{if permission_check_account_user($active_menu['permission_name'], false) && (empty($active_menu['is_display']) || is_array($active_menu['is_display']) && in_array($_W['account']['type'], $active_menu['is_display']))}
	<li {if $action == $active_menu['active']}class="active"{/if}><a href="{$active_menu['url']}">{$active_menu['title']}</a></li>
	{/if}
	{/loop}
</ul>
<div id="js-wesite-article-display" ng-controller="wesiteArticleDisplay" ng-cloak>
	<div class="search-box we7-padding-bottom clearfix">
		<div class="pull-right">
			
		</div>
		<form action="" method="post" class="search-form " role="form">
			<input type="hidden" name="a" value="article" />
			<input type="hidden" name="c" value="site" />
			<input type="hidden" name="do" value="display" />
			<div class="pull-left">
				<select name="" class="we7-margin-right">
					<option data-url="{php echo filter_url('parentid:,childid:');}" >请选择一级分类</option>
					{loop $parent $parentid $row}
					<option data-url="{php echo filter_url('parentid:' . $parentid . ',childid:');}" {if $_GPC['parentid'] == $parentid} selected{/if}>{$row['name']}</option>
					{/loop}
				</select>
				<select name="" class="we7-margin-right">
					<option data-url="{php echo filter_url('childid:');}" >请选择二级分类</option>
					{if $_GPC['parentid']}
						{loop $children[$_GPC['parentid']] $row}
						<option data-url="{php echo filter_url('childid:' . $row[id]);}" {if $_GPC['childid'] == $row[id]} selected{/if}>{$row['name']}</option>
						{/loop}
					{/if}
				</select>

			</div>
			<div class="input-group we7-padding-left ">
				<input class="form-control" name="keyword" id="" type="text" value="{$_GPC['keyword']}" placeholder="请输入标题名">
				<span class="input-group-btn"><button class="btn btn-default"><i class="fa fa-search"></i></button></span>
			</div>
		</form>
		是否开启留言功能&nbsp;&nbsp;
		<span ng-class="setting.comment_status == 1 ? 'switch switchOn' : 'switch'" ng-click="comment()"></span>
		<a href="{php echo url('site/article/post')}" class="btn btn-primary we7-margin-left">+新建文章</a>
	</div>
	<form action="./index.php?c=site&a=article&do=del" method="post" class="we7-form" role="form">
		<table class="table we7-table table-hover article-list vertical-middle ">
			<col width="80px">
			<col width="70px"/>
			<col width=""/>
			<col width="120px"/>
			<col width="270px"/>
			<tr>
				<th></th>
				<th>排序</th>
				<th class="text-left">标题</th>
				<th>属性</th>
				<th class="text-right">操作</th>
			</tr>
			<tr ng-if="!articleList">
				<td colspan="5" class="text-center">暂无数据</td>
			</tr>
			<tr ng-repeat="article in articleList" ng-if="articleList">
				<td>
					<input type="checkbox" we7-check-all="1" name="rid[]" id="rid-{{article.id}}" value="{{article.id}}">
					<label for="rid-{{article.id}}">&nbsp;</label>
				</td>
				<td ng-bind="article.displayorder"></td>
				<td class="text-left" ng-bind="article.title"></td>
				<td>
					<span class="label label-primary" ng-if="article.ishot == 1">头条</span>
					<span class="label label-primary" ng-if="article.iscommend == 1">推荐</span>
				</td>
				<td>
					<div class="link-group">
						<a class="article-list-reply" ng-if="article.count" ng-href="{{commentListLink}}id={{article.id}}">查看留言</a>
						<a  ng-if="!article.count" ng-href="{{commentListLink}}id={{article.id}}">查看留言</a>
						<a href="javascript:;" id="copy-{{article.id}}" clipboard supported="supported" text="article.link" on-copied="success(article.id)">复制链接</a>
						<a href="javascript:;" ng-click="editArticle(article.id)">编辑</a>
						<a href="javascript:;" class="del" ng-click="delArticle(article.id)">删除</a>
					</div>
				</td>
			</tr>
		</table>
		<div class="pull-left  we7-margin-left-sm">
			<input type="checkbox" we7-check-all="1" name="rid[]" id="select_all" value="1" ng-style="{'margin-left': '30px'}">
			<label for="select_all">&nbsp;</label>
			<input type="hidden" name="token" value="{$_W['token']}" />
			<input type="submit" class="btn btn-danger" name="submit" value="删除" onclick="if(!confirm('确定删除选中的规则吗？')) return false;"/>
		</div>
		<div class="text-right we7-margin-top">
			{$pager}
		</div>
	</form>
</div>
<script>
	$('#select_all').click(function(){
		$('.article-list :checkbox').prop('checked', $(this).prop('checked'));
	});
	angular.module('wesiteApp').value('config', {
		category: {php echo !empty($category) ? json_encode($category) : 'null'},
		articleList: {php echo !empty($list) ? json_encode($list) : 'null'},
		articleComment: {php echo !empty($article_comment) ? json_encode($article_comment) : 'null'},
		setting: {php echo !empty($setting) ? json_encode($setting) : 'null'},
		copyCommonLink: "{php echo murl('site/site/detail', array('id' => ''), true, true)}",
		commentListLink: "{php echo url('site/comment/display')}",
		commentLink: "{php echo url('site/comment/change_status')}"
	});
	angular.bootstrap($('#js-wesite-article-display'), ['wesiteApp']);	
</script>
{template 'common/footer'}